//author:kakake
var Model = /** @class */ (function () {
    function Model() {
    }
    return Model;
}());

//author:kakake
var Common = /** @class */ (function () {
    function Common() {
    }
    return Common;
}());

//author:kakake
var tsAdminController = /** @class */ (function () {
    function tsAdminController() {
        this.data = {
            dbConn: TSLobsterAPI.DbHelper.setdbconn('42.192.250.43', 'CloudCMS', 'sa', 'Lobster@123')
        };
        this.dao = new tsAdminDao();
    }
    /**
     * 获取站点列表
     */
    tsAdminController.prototype.getwebsitelist = function () {
        var pageInfo = {
            key: "WebsiteId",
            page: TSLobsterAPI.Program.RequestQuery("page", "1"),
            perPage: TSLobsterAPI.Program.RequestQuery("limit", "999"),
            totalRecord: 100
        };
        var searchstr = TSLobsterAPI.Program.RequestQuery("searchstr", "");
        var workId = TSLobsterAPI.Program.GetWorkId();
        //var data = [{ "rowid": 1, "WebsiteId": 1, "WebsiteCode": null, "Url": "https://devopen.uxhealthy.com", "Title": "互联网护理网站", "Keywords": "互联网护理网站", "Memo": "互联网护理网站", "DelFlag": 0, "WorkId": 1, "CreateTime": "2021-01-28 15:39:40", "UpdateTime": "2022-04-29 17:35:46" }, { "rowid": 2, "WebsiteId": 2, "WebsiteCode": null, "Url": "https://devopen.uxhealthy.com", "Title": "互联网医院帮助中心", "Keywords": "互联网医院帮助中心", "Memo": "互联网医院帮助中心", "DelFlag": 0, "WorkId": 1, "CreateTime": "2021-01-28 15:39:51", "UpdateTime": "2021-08-05 14:16:44" }, { "rowid": 3, "WebsiteId": 3, "WebsiteCode": null, "Url": "https://devopen.uxhealthy.com", "Title": "互联网医院健康学堂", "Keywords": "互联网医院健康学堂", "Memo": "互联网医院健康学堂", "DelFlag": 0, "WorkId": 1, "CreateTime": "2021-01-28 15:40:00", "UpdateTime": "2021-02-01 18:00:49" }, { "rowid": 4, "WebsiteId": 4, "WebsiteCode": null, "Url": "https://devopen.uxhealthy.com", "Title": "互联网医院微官网", "Keywords": "互联网医院微官网", "Memo": "互联网医院微官网", "DelFlag": 0, "WorkId": 1, "CreateTime": "2021-01-28 15:40:11", "UpdateTime": "2021-08-05 14:54:42" }, { "rowid": 5, "WebsiteId": 5, "WebsiteCode": "FollowUp", "Url": "https://devopen.uxhealthy.com", "Title": "随访系统知识库", "Keywords": "随访系统知识库", "Memo": "随访系统知识库", "DelFlag": 0, "WorkId": 1, "CreateTime": "2021-01-28 15:40:21", "UpdateTime": "2021-02-01 18:02:19" }, { "rowid": 6, "WebsiteId": 25, "WebsiteCode": null, "Url": "1", "Title": "体检科介绍", "Keywords": null, "Memo": null, "DelFlag": 0, "WorkId": 1036, "CreateTime": "2021-02-03 15:12:12", "UpdateTime": "2021-02-03 15:12:12" }, { "rowid": 7, "WebsiteId": 26, "WebsiteCode": null, "Url": "1", "Title": "测试站点2", "Keywords": "IM", "Memo": "CS", "DelFlag": 0, "WorkId": 1036, "CreateTime": "2021-02-03 16:57:43", "UpdateTime": "2022-11-14 12:24:23" }, { "rowid": 8, "WebsiteId": 27, "WebsiteCode": "FollowUp", "Url": "suifzhishiku", "Title": "随访知识库", "Keywords": null, "Memo": null, "DelFlag": 0, "WorkId": 1038, "CreateTime": "2021-02-20 18:06:28", "UpdateTime": "2021-02-20 18:06:28" }, { "rowid": 9, "WebsiteId": 1019, "WebsiteCode": "HeartExchange", "Url": "https://amispage.mcloudsoft.cn", "Title": "心交流", "Keywords": "网心康心交流", "Memo": "网心康心交流", "DelFlag": 0, "WorkId": 2049, "CreateTime": "2021-03-12 16:00:35", "UpdateTime": "2022-04-14 11:05:31" }, { "rowid": 10, "WebsiteId": 1020, "WebsiteCode": "FollowUp", "Url": "suifangxuanjiao", "Title": "随访宣教", "Keywords": null, "Memo": null, "DelFlag": 0, "WorkId": 2051, "CreateTime": "2021-03-31 11:22:47", "UpdateTime": "2021-03-31 11:22:47" }]
        return {
            list: this.dao.getwebsitelist(pageInfo, searchstr, workId),
            //list:data,
            count: pageInfo.totalRecord
        };
    };
    tsAdminController.prototype.savewebsite = function () {
        var website = JSON.parse(TSLobsterAPI.Program.RequestBody());
        website.WorkId = TSLobsterAPI.Program.GetWorkId();
        if (website.websiteId == 0) {
            this.dao.insertwebsite(website);
        }
        else {
            this.dao.updatewebsite(website);
        }
        return { result: true };
    };
    tsAdminController.prototype.setwebsitestatus = function () {
        var param = {
            websiteId: TSLobsterAPI.Program.RequestQuery("websiteId", "0"),
            delFlag: TSLobsterAPI.Program.RequestQuery("delFlag", "0")
        };
        this.dao.setwebsitestatus(param);
        return { result: true };
    };
    tsAdminController.prototype.getnodelist = function () {
        var param = {
            websiteid: TSLobsterAPI.Program.RequestQuery("websiteId", "0")
        };
        var data = this.dao.getnodelist(param);
        return { data: data, count: data.length };
    };
    tsAdminController.prototype.disablenode = function () {
        var param = {
            nodeid: TSLobsterAPI.Program.RequestQuery("nid", "0"),
            status: TSLobsterAPI.Program.RequestQuery("status", "0")
        };
        this.dao.disablenode(param);
        return { result: true };
    };
    tsAdminController.prototype.deletenode = function () {
        var param = {
            nodeid: TSLobsterAPI.Program.RequestQuery("nid", "0")
        };
        this.dao.deletenode(param);
        return { result: true };
    };
    tsAdminController.prototype.movenode = function () {
        var param = {
            nodeid: TSLobsterAPI.Program.RequestQuery("nid", "0"),
            movestatus: parseInt(TSLobsterAPI.Program.RequestQuery("moveStatus", "0")),
            oldsort: 0,
            parentid: 0,
            WebsiteId: 0,
            workid: TSLobsterAPI.Program.GetWorkId()
        };
        TSLobsterAPI.Utils.TrackLog('param', param);
        var curnode = this.dao.getnode(param);
        param.oldsort = curnode.NodeSort;
        param.parentid = curnode.ParentID;
        param.WebsiteId = curnode.WebsiteId;
        TSLobsterAPI.Utils.TrackLog('param', param);
        var exchangenode = this.dao.getexchangenode(param);
        TSLobsterAPI.Utils.TrackLog('exchangenode', exchangenode);
        if (!exchangenode.NID) {
            if (param.movestatus == 0) {
                throw "首行数据不能上移";
            }
            else {
                throw "尾行数据不能下移";
            }
        }
        else {
            this.dao.updatenodesort({ nodeid: curnode.NID, nodesort: exchangenode.NodeSort });
            this.dao.updatenodesort({ nodeid: exchangenode.NID, nodesort: param.oldsort });
        }
        return { result: true };
    };
    tsAdminController.prototype.savenode = function () {
        var node = JSON.parse(TSLobsterAPI.Program.RequestBody());
        if (node.NID == 0) {
            this.dao.insertnode(node);
        }
        else {
            this.dao.updatenode(node);
        }
        return { result: true };
    };
    tsAdminController.prototype.getnodeandparentnode = function () {
        var nodeid = parseInt(TSLobsterAPI.Program.RequestQuery("nid", "0"));
        var data = this.dao.getnodeandparentnode(nodeid);
        return { data: data };
    };
    tsAdminController.prototype.getcontentlist = function () {
        var pageInfo = {
            key: "CID desc",
            page: TSLobsterAPI.Program.RequestQuery("page", "1"),
            perPage: TSLobsterAPI.Program.RequestQuery("limit", "999"),
            totalRecord: 100
        };
        var searchstr = TSLobsterAPI.Program.RequestQuery("key", "");
        var nodeid = TSLobsterAPI.Program.RequestQuery("nid", "0");
        var data = this.dao.getcontentlist(searchstr, nodeid, pageInfo);
        return { list: data, count: pageInfo.totalRecord };
    };
    tsAdminController.prototype.updatecontextstate = function () {
        var cid = parseInt(TSLobsterAPI.Program.RequestQuery("cid", "0"));
        var state = parseInt(TSLobsterAPI.Program.RequestQuery("state", "0"));
        this.dao.updatecontextstate(cid, state);
        return { result: true };
    };
    tsAdminController.prototype.deletecontext = function () {
        var cid = parseInt(TSLobsterAPI.Program.RequestQuery("cid", "0"));
        this.dao.deletecontext(cid);
        return { result: true };
    };
    tsAdminController.prototype.getarticle = function () {
        var cid = parseInt(TSLobsterAPI.Program.RequestQuery("cid", "0"));
        var data = this.dao.getarticle(cid);
        return { data: data };
    };
    tsAdminController.prototype.savecontext = function () {
        var context = JSON.parse(TSLobsterAPI.Program.RequestBody());
        //新增
        if (context.CID == 0) {
            this.dao.insertcontext(context);
        }
        else {
            this.dao.updatecontext(context);
        }
        return { result: true };
    };
    tsAdminController.prototype.getIndexSetting = function () {
        var websiteId = TSLobsterAPI.Program.RequestQuery("websiteId", "0");
        var pageInfo = {
            key: "sort",
            page: TSLobsterAPI.Program.RequestQuery("page", "1"),
            perPage: TSLobsterAPI.Program.RequestQuery("limit", "999"),
            totalRecord: 100
        };
        var data = this.dao.getIndexSetting(websiteId, pageInfo);
        return { data: data, count: pageInfo.totalRecord };
    };
    tsAdminController.prototype.getWebSiteListData = function () {
        var workId = TSLobsterAPI.Program.GetWorkId();
        var data = this.dao.getWebSiteListData(workId);
        return { data: data };
    };
    tsAdminController.prototype.saveindexsetting = function () {
        var setting = JSON.parse(TSLobsterAPI.Program.RequestBody());
        setting.WorkId = TSLobsterAPI.Program.GetWorkId();
        if (setting.Id == 0) {
            this.dao.insertindexsetting(setting);
        }
        else {
            this.dao.updateindexsetting(setting);
        }
        return { result: true };
    };
    tsAdminController.prototype.setsettingstatus = function () {
        var id = TSLobsterAPI.Program.RequestQuery("id", "0");
        var delflag = TSLobsterAPI.Program.RequestQuery("delflag", "0");
        this.dao.setsettingstatus(id, delflag);
        return { result: true };
    };
    tsAdminController.prototype.getcontextlistbywebsiteId = function () {
        var websiteId = TSLobsterAPI.Program.RequestQuery("websiteId", "0");
        var data = this.dao.getcontextlistbywebsiteId(websiteId);
        return { data: data };
    };
    tsAdminController.prototype.getnodelistbywebsiteId = function () {
        var websiteId = TSLobsterAPI.Program.RequestQuery("websiteId", "0");
        var data = this.dao.getnodelistbywebsiteId(websiteId);
        return { data: data };
    };
    return tsAdminController;
}());

//author:kakake
var tsAdminDao = /** @class */ (function () {
    function tsAdminDao() {
        this.data = {
            //42.192.250.43
            //10.0.4.5
            dbConn: TSLobsterAPI.DbHelper.setdbconn('42.192.250.43', 'CloudCMS', 'sa', 'Lobster@123')
        };
    }
    tsAdminDao.prototype.getwebsitelist = function (pageInfo, searchstr, workId) {
        var dbparams = {
            searchstr: '%' + searchstr + '%',
            workId: workId
        };
        var strsql = "select [WebsiteId], [WebsiteCode], [Url], [Title], [Keywords], [Memo], [DelFlag], [WorkId],CONVERT(varchar(50), [CreateTime],20) CreateTime,CONVERT(varchar(50), [UpdateTime],20) UpdateTime from CMS_BaseWebsite \
         where WorkId=@workId";
        if (dbparams.searchstr != '') {
            strsql += " and (WebsiteCode like @searchstr or Title like @searchstr)";
        }
        TSLobsterAPI.Utils.TrackLog('getwebsitelist', strsql);
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, dbparams, pageInfo);
    };
    tsAdminDao.prototype.insertwebsite = function (website) {
        website["delflag"] = 0;
        var strsql = "insert into CMS_BaseWebsite (WebsiteCode,Url,Title,Keywords,Memo,DelFlag,WorkId,CreateTime,UpdateTime) \
        values (@code,@url,@title,@keywords,@memo,@delflag,@WorkId,GETDATE(),GETDATE())";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, website);
    };
    tsAdminDao.prototype.updatewebsite = function (website) {
        var strsql = "update CMS_BaseWebsite set Url=@url,Title=@title,Keywords=@keywords,Memo=@memo,UpdateTime=GETDATE() where WebsiteId=@websiteId";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, website);
    };
    tsAdminDao.prototype.setwebsitestatus = function (param) {
        var strsql = "update CMS_BaseWebsite set DelFlag=@delFlag,UpdateTime=GETDATE() where WebsiteId=@websiteId";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.getnodelist = function (param) {
        var strsql = "select * from CMS_Node where WebsiteId =@websiteid and IsDel = 0 and parentID=-1 ORDER BY ParentID,NodeSort";
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, param, null);
    };
    tsAdminDao.prototype.disablenode = function (param) {
        var strsql = "UPDATE CMS_Node SET NodeStatus=@status WHERE NID=@nodeid";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.deletenode = function (param) {
        var strsql = "UPDATE CMS_Node SET IsDel=1,NodeSort=-1 WHERE NID=@nodeid";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.getnode = function (param) {
        var strsql = "select * from CMS_Node where NID=@nodeid";
        return TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.getexchangenode = function (param) {
        var strsql = "select top 1 * from CMS_Node where WebSiteId =@WebsiteId and ParentID=@parentid and IsDel = 0  ";
        if (param.movestatus == 0) {
            strsql += " and NodeSort<@oldsort order by NodeSort desc"; //上移
        }
        else {
            strsql += " and NodeSort>@oldsort order by NodeSort"; //下移
        }
        return TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.updatenodesort = function (param) {
        var strsql = "UPDATE CMS_Node SET NodeSort=@nodesort WHERE NID=@nodeid";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.getnodeandparentnode = function (nodeid) {
        TSLobsterAPI.Utils.TrackLog("nodeid", nodeid);
        var node = null;
        var parentnode = null;
        if (nodeid > 0) {
            node = this.getnode({ nodeid: nodeid });
            TSLobsterAPI.Utils.TrackLog("node", node);
            parentnode = this.getnode({ nodeid: node.ParentID });
            TSLobsterAPI.Utils.TrackLog("parentnode", parentnode);
        }
        return { entity: node, parentEntity: parentnode };
    };
    tsAdminDao.prototype.insertnode = function (param) {
        param.NodeSort = this.getmaxnodesort(param.ParentID, param.WebsiteId);
        param.WorkId = TSLobsterAPI.Program.GetWorkId();
        var strsql = "insert into CMS_Node (NodeName,NodeCode,NodeTitle,ParentID,NodeSort,NodeDesc,NodeStatus,NodeDepth,NodeIcon,AddTime,IsDel,WorkId,WebsiteId) \
        values (@NodeName,@NodeCode,'',@ParentID,@NodeSort,@NodeDesc,@NodeStatus,@NodeDepth,'',GETDATE(),0,@WorkId,@WebsiteId)";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.updatenode = function (param) {
        var strsql = "update CMS_Node set NodeName=@NodeName,NodeCode=@NodeCode,NodeDesc=@NodeDesc where NID=@NID";
        return TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, param);
    };
    tsAdminDao.prototype.getmaxnodesort = function (parentid, websiteid) {
        var strsql = "select max(NodeSort) MaxSort from CMS_Node where ParentID=@parentid and WebsiteId=@websiteid";
        var result = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, { parentid: parentid, websiteid: websiteid });
        if (result.MaxSort == null) {
            return 1;
        }
        else {
            return parseInt(result.MaxSort) + 1;
        }
    };
    tsAdminDao.prototype.getcontentlist = function (searchstr, nodeid, pageInfo) {
        var strsql = "select * from CMS_BaseContextManage where IsDel=0";
        if (nodeid > 0) {
            strsql += " And NodeId=@nodeid";
        }
        if (searchstr != "") {
            strsql += " And Title like @title";
        }
        var param = {
            nodeid: nodeid,
            title: '%' + searchstr + '%'
        };
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, param, pageInfo);
    };
    tsAdminDao.prototype.updatecontextstate = function (cid, state) {
        var strsql = "";
        var strsql2 = "";
        var strsql3 = "";
        if (state == 0) {
            strsql = "UPDATE CMS_BaseContextManage SET Status=0,IsExpectPublish=0 WHERE CID=@cid";
        }
        else {
            strsql = "UPDATE CMS_BaseContextManage SET Status=99,ReleaseTime=GETDATE() WHERE CID=@cid";
        }
        if (state == 0) {
            strsql2 = "UPDATE CMS_BaseContext SET Status = 0 where  CID =@cid and IsDel = 0";
        }
        else {
            strsql2 = "UPDATE CMS_BaseContext SET Status = 99,ReleaseTime = GETDATE() where  CID =@cid and IsDel = 0";
        }
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { cid: cid });
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql2, { cid: cid });
    };
    tsAdminDao.prototype.deletecontext = function (cid) {
        var strsql = "UPDATE CMS_BaseContextManage SET IsDel=1,LastUpdateTime=GETDATE() WHERE CID=@cid";
        var strsql2 = "UPDATE CMS_BaseContext SET IsDel = 1,LastUpdateTime = GETDATE() where  CID =@cid";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { cid: cid });
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql2, { cid: cid });
    };
    tsAdminDao.prototype.getarticle = function (cid) {
        var strsql = "select * from CMS_BaseContextManage where CID=@cid";
        var strsql2 = "select * from CMS_U_ArticleManage where CID=@cid";
        var res = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, { cid: cid });
        var res2 = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql2, { cid: cid });
        var obj = { cont: res, art: res2 };
        return obj;
    };
    tsAdminDao.prototype.insertcontext = function (context) {
        context.WorkId = TSLobsterAPI.Program.GetWorkId();
        //插入管理表
        var strsql = "INSERT INTO CMS_BaseContextManage(Title,Intraduce,PicPath,IsTop,IsHot,Status,IsDel,NodeID,TotalHit,AddTime,WorkId,IsExpectPublish,ShareNum)\
            VALUES (@Title,@Intraduce,@PicPath,0,0,0,0,@NodeID,0,getdate(),@WorkId,0,0);SELECT @@IDENTITY AS CID";
        var res = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, context);
        if (res.CID != null) {
            strsql = "INSERT INTO CMS_U_ArticleManage(CID,U_Cont) VALUES(@CID,@U_Cont)";
            TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { CID: res.CID, U_Cont: context.U_Cont });
        }
        context.CID = res.CID;
        //插入发布表
        strsql = "INSERT INTO CMS_BaseContext(CID,Title,Intraduce,PicPath,IsTop,IsHot,Status,IsDel,NodeID,TotalHit,AddTime,WorkId,ShareNum)\
            VALUES (@CID,@Title,@Intraduce,@PicPath,0,0,0,0,@NodeID,0,getdate(),@WorkId,0);SELECT @@IDENTITY AS ID";
        res = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, context);
        if (res.ID != null) {
            strsql = "INSERT INTO CMS_U_Article(ID,U_Cont) VALUES(@ID,@U_Cont)";
            TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { ID: res.ID, U_Cont: context.U_Cont });
        }
    };
    tsAdminDao.prototype.updatecontext = function (context) {
        context.WorkId = TSLobsterAPI.Program.GetWorkId();
        //更新管理表
        var strsql = "update CMS_BaseContextManage set Title=@Title,Intraduce=@Intraduce,PicPath=@PicPath where CID=@CID ";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, context);
        strsql = "update CMS_U_ArticleManage set U_Cont=@U_Cont  where CID=@CID";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, context);
        //发布状态插入发布表
        if (context.Status == 99) {
            //更新管理表为未发表
            strsql = "update CMS_BaseContextManage set Status=0 where CID=@CID";
            TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { CID: context.CID });
            //插入新数据
            strsql = "INSERT INTO CMS_BaseContext(CID,Title,Intraduce,PicPath,IsTop,IsHot,Status,IsDel,NodeID,TotalHit,AddTime,WorkId,ShareNum)\
                VALUES (@CID,@Title,@Intraduce,@PicPath,0,0,98,0,@NodeID,0,getdate(),@WorkId,0);SELECT @@IDENTITY AS ID";
            var res = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, context);
            if (res.ID != null) {
                strsql = "INSERT INTO CMS_U_Article(ID,U_Cont) VALUES(@ID,@U_Cont)";
                TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { ID: res.ID, U_Cont: context.U_Cont });
            }
        }
        //更新最后一条发布表
        else {
            strsql = "select max(ID) as ID from CMS_BaseContext where CID=@CID";
            var res = TSLobsterAPI.DbHelper.DbGetJsonObject(this.data.dbConn, strsql, { CID: context.CID });
            strsql = "update CMS_BaseContext set Title=@Title,Intraduce=@Intraduce,PicPath=@PicPath where ID=@ID ";
            TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { ID: res.ID, Title: context.Title, Intraduce: context.Intraduce, PicPath: context.PicPath });
            strsql = "update CMS_U_Article set U_Cont=@U_Cont  where ID=@ID";
            TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { ID: res.ID, U_Cont: context.U_Cont });
        }
    };
    tsAdminDao.prototype.getIndexSetting = function (websiteId, pageInfo) {
        var strsql = "select a.*,b.Title as WebSiteTitle from CMS_IndexSetting a \
        inner join CMS_BaseWebsite b\
        on a.WebSiteId=b.WebsiteId\
        where  a.websiteid=@websiteId";
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, { websiteId: websiteId }, pageInfo);
    };
    tsAdminDao.prototype.getWebSiteListData = function (workId) {
        var strsql = "select WebSiteId,Title from CMS_BaseWebsite where  DelFlag=0 and WorkId=@workId";
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, { workId: workId }, null);
    };
    tsAdminDao.prototype.insertindexsetting = function (setting) {
        var strsql = "INSERT INTO CMS_IndexSetting(Title,Title_en,[Desc],Layout,TextBackgroundColor,TextWidth,TotalWidth,BackImage,Url,UrlType,UrlParamValue,WebSiteId,WorkId,Sort,DelFlag)VALUES \
            (@Title,@Title_en,@Desc,@Layout,@TextBackgroundColor,@TextWidth,@TotalWidth,@BackImage,@Url,@UrlType,@UrlParamValue,@WebSiteId,@WorkId,@Sort,@DelFlag)";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, setting);
    };
    tsAdminDao.prototype.updateindexsetting = function (setting) {
        var strsql = "UPDATE CMS_IndexSetting\
                SET Title = @Title \
               ,Title_en = @Title_en \
               ,[Desc]= @Desc \
               ,Layout = @Layout \
               ,TextBackgroundColor =@TextBackgroundColor \
               ,TextWidth = @TextWidth \
               ,TotalWidth =@TotalWidth \
               ,BackImage = @BackImage \
               ,Url = @Url \
               ,UrlType = @UrlType \
               ,UrlParamValue = @UrlParamValue \
               ,WebSiteId = @WebSiteId \
               ,Sort = @Sort \
                 WHERE Id=@Id";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, setting);
    };
    tsAdminDao.prototype.setsettingstatus = function (id, delflag) {
        var strsql = "UPDATE CMS_IndexSetting SET DelFlag=@delflag WHERE Id=@id";
        TSLobsterAPI.DbHelper.DbExecuteUpdate(this.data.dbConn, strsql, { id: id, delflag: delflag });
    };
    tsAdminDao.prototype.getcontextlistbywebsiteId = function (websiteId) {
        var strsql = "select * from CMS_BaseContextManage where NodeID   \
        in  (select NID from CMS_Node where WebsiteId=@websiteId and IsDel=0) and IsDel=0";
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, { websiteId: websiteId }, null);
    };
    tsAdminDao.prototype.getnodelistbywebsiteId = function (websiteId) {
        var strsql = "select * from CMS_Node where WebsiteId=@websiteId and IsDel=0";
        return TSLobsterAPI.DbHelper.DbGetJsonData(this.data.dbConn, strsql, { websiteId: websiteId }, null);
    };
    return tsAdminDao;
}());

//author:kakake
var tsAdminService = /** @class */ (function () {
    function tsAdminService() {
    }
    return tsAdminService;
}());

